let count = 5; //每一页的条数
let page = 1; //当前页
//渲染页面  报告
showData()
function showData() {
  $.ajax({
    url: '/baogao/query',
    data: {
      count: count,
      page: page
    },
    success: (res) => {
      if (res.error) {
        console.log(res.erro);
      } else {
        // 渲染表格
        $('.ttbody').html('')
        $(res.data).each((index, item) => {
          $('.ttbody').append(`
                    <tr data-id="${item.g_id}">
                        <td>${item.g_date.slice(0, 10)}</td>
                        <td>${item.g_baogao}</td>
                        <td>${item.g_name}</td>
                        <td><span class='iconfont icon-dian'></span>${item.g_piyue}</td>
                        <td><a href="../../pages/xitongshouye--shikaiwen/baogaoxiangqing.html"> <span class='iconfont icon-youjiantou'>详情</span></a> </td>
                    </tr>
                    `);
        });
      }
    }
  });
};

//渲染  公告
showData1()
function showData1() {
  $.ajax({
    url: '/gonggao/query',
    data: {
      count: count,
      page: page
    },
    success: (res) => {
      if (res.error) {
        console.log(res.erro);
      } else {
        // 渲染表格
        $('.ytable').html('')
        $(res.data).each((index, item) => {
          $('.ytable').append(`
                    <tr data-id="${item.g_id}">
                       <td><span>【通知公告】</span>${item.g_biaoti}</td>
   
                        <td> <span class='iconfont icon-shizhong'></span>${item.g_date.slice(0, 10)}</td>
                     
                    </tr>
                    `);
        });
        $('.ul').html('');
        for (let i = 1; i <= Math.ceil((res.total / count)); i++) {
          if (page == i) {
            $('.ul').append(`
                            <li><a class="active" href="javascript:;">${i}</a></li>
                        `)
          } else {
            $('.ul').append(`
                            <li><a href="javascript:;">${i}</a></li>
                        `)
          }

        }
      }
    }
  });
};
